﻿namespace WMS6.Services
{
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.ServiceModel.Activation;
    using WMS6.BLL;
    using WMS6.Common;
    using WMS6.DataEntity;

    [AspNetCompatibilityRequirements(RequirementsMode=AspNetCompatibilityRequirementsMode.Allowed)]
    public class BaseInfoDetailService : IBaseInfoDetailService
    {
        public string DeleteDetail(List<string> mainID, List<string> subId, List<string> pk3, string className, PubParasInfo pubParasInfo)
        {
            try
            {
                string result = BaseInfoDetailFactory.CreateInstance(className, pubParasInfo).DeleteDetail(mainID, subId, pk3);
                new OperationLogBLL().Insert("BaseInfoDetailService_Delete", mainID, subId, pk3, className, pubParasInfo);
                return result;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "BaseInfoDetailService异常");
            }
            return "";
        }

        public DataSet GetAllDetailInfo(string className, PubParasInfo pubParasInfo)
        {
            try
            {
                return BaseInfoDetailFactory.CreateInstance(className, pubParasInfo).GetAllDetailInfo();
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "BaseInfoDetailService异常");
            }
            return null;
        }

        public DataSet GetDetaiInfolByQueryEntity(object detailQuery, string className, PubParasInfo pubParasInfo)
        {
            try
            {
                return BaseInfoDetailFactory.CreateInstance(className, pubParasInfo).GetDetaiInfolByQueryEntity(detailQuery);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "BaseInfoDetailService异常");
            }
            return null;
        }

        public object GetDetailInfoByID(string mainID, string subID, string pk3, string className, PubParasInfo pubParasInfo)
        {
            try
            {
                return BaseInfoDetailFactory.CreateInstance(className, pubParasInfo).GetDetailInfoByID(mainID, subID, pk3);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "BaseInfoDetailService异常");
            }
            return null;
        }

        public List<object> GetDetailInfoListByID(string mainID, string subID, string className, PubParasInfo pubParasInfo)
        {
            try
            {
                return BaseInfoDetailFactory.CreateInstance(className, pubParasInfo).GetDetailInfoListByID(mainID, subID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "BaseInfoDetailService异常");
            }
            return null;
        }

        public string InsertDetail(object obj, string className, PubParasInfo pubParasInfo)
        {
            try
            {
                string result = BaseInfoDetailFactory.CreateInstance(className, pubParasInfo).InsertDetail(obj);
                new OperationLogBLL().Insert("BaseInfoDetailService_Insert", obj, className, pubParasInfo);
                return result;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "BaseInfoDetailService异常");
            }
            return "";
        }

        public string UpdateDetail(object obj, string className, PubParasInfo pubParasInfo)
        {
            try
            {
                string result = BaseInfoDetailFactory.CreateInstance(className, pubParasInfo).UpdateDetail(obj);
                new OperationLogBLL().Insert("BaseInfoDetailService_Update", obj, className, pubParasInfo);
                return result;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "BaseInfoDetailService异常");
            }
            return "";
        }

        public string UpdateIsActive(List<string> mainID, List<string> subId, string isActive, string className, PubParasInfo pubParasInfo)
        {
            try
            {
                string result = BaseInfoDetailFactory.CreateInstance(className, pubParasInfo).UpdateIsActive(mainID, subId, isActive);
                new OperationLogBLL().Insert("BaseInfoDetailService_UpdateIsActive", mainID, subId, isActive, className, pubParasInfo);
                return result;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "BaseInfoDetailService异常");
            }
            return "";
        }
    }
}

